* Import the dataset

import delimited "/Users/Enrijeta/Dropbox/VoteSwitchers/psrm_replication/predicted_probabilities_STATA/ces2020.csv"


* Prepare variables for analysis

encode trump_switchers, gen(trump_switchers1)
label drop trump_switchers1
recode trump_switchers1 (1=0) (2=1) (3=.)

encode  dem_switchers, gen(dem_switchers1)
label drop  dem_switchers1
recode  dem_switchers1 (1=0) (2=1) (3=.)

encode  other_trump_switchers, gen(other_trump_switchers1)
label drop  other_trump_switchers1
recode  other_trump_switchers1 (1=0) (2=1) (3=.)

encode  other_dem_switchers, gen(other_dem_switchers1)
label drop  other_dem_switchers1
recode  other_dem_switchers1 (1=0) (2=1) (3=.)

encode  biden_2020, gen(biden_20201)
label drop  biden_20201
recode  biden_20201 (1=0) (2=1) (3=.)

encode  contracted_covid, gen(contracted_covid1)
label drop  contracted_covid1
recode  contracted_covid1 (1=0) (2=1) (3=.)

encode  police, gen(police1)
label drop  police1
recode  police1 (1=0) (2=1) (3=.)

encode  scotus_rbg, gen(scotus_rbg1)
label drop  scotus_rbg1
recode  scotus_rbg1 (1=0) (2=1) (3=.)

encode  economy_pocketbook_rescaled, gen(economy_pocketbook_rescaled1)
label drop  economy_pocketbook_rescaled1
recode  economy_pocketbook_rescaled1 (1=0) (2=0.25) (3=0.5) (4=0.75) (5=1) (6=.)

encode  economy_socio_rescaled, gen(economy_socio_rescaled1)
label drop  economy_socio_rescaled1
recode  economy_socio_rescaled1 (1=0) (2=0.25) (3=0.5) (4=0.75) (5=1) (6=.)

encode  healthcare_rescaled, gen(healthcare_rescaled1)
label drop  healthcare_rescaled1
recode  healthcare_rescaled1 (1=0) (2=0.25) (3=0.5) (4=0.75) (5=1) (6=.)

encode  immigration_rescaled, gen(immigration_rescaled1)
label drop  immigration_rescaled1
recode  immigration_rescaled1 (1=0) (2=0.2) (3=0.4) (4=0.6) (5=0.8) (6=1) (7=.)

encode  political_awareness, gen(political_awareness1)
label drop  political_awareness1
recode  political_awareness1 (5=.)

encode  party_id, gen(party_id1)
label drop  party_id1
recode  party_id1 (4=.)

encode  ideology, gen(ideology1)
label drop  ideology1
recode  ideology1 (6=.)

encode  income, gen(income1)
label drop  income1
recode  income1 (2=10) (3=11) (4=12) (5=13) (6=14) (7=15) (8=16) (9=2) (10=3) ///
(11=4) (12=5) (13=6) (14=7) (15=8) (16=9) (17=.)

rename age age1
rename female female1
rename race_cat race_cat1
rename education education1


* create dummies for partyID and race

tabulate party_id1, generate(partyid_dum)
tabulate race_cat1, generate(race_dum)



*===============================================================*
*===============================================================*
* Predicted Probabilitits with Observed Values for Switcher to  *
* Major Party R --> D, Model 4                                  *
*===============================================================*
*===============================================================*

logit trump_switchers1  scotus_rbg1 police1 economy_pocketbook_rescaled1 ///
      economy_socio_rescaled1 healthcare_rescaled1  immigration_rescaled1  ///
	  political_awareness1  contracted_covid1  partyid_dum2 partyid_dum3 ideology1 ///
	  age1 female1 race_dum2 race_dum3 race_dum4  education1  income1, vce(robust)

predict p if e(sample)
sum p

*=============================================*
* Predicted Probabilitits for RBG replacement *
*=============================================*

* Democrat RBG replacement
gen rbg0_demR = normal(_b[_cons] + _b[scotus_rbg1]*0 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen rbg1_demR = normal(_b[_cons] + _b[scotus_rbg1]*1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_rbg_demR = rbg1_demR - rbg0_demR
sum rbg0_demR rbg1_demR effect_rbg_demR 

* Republican RBG replacement
gen rbg0_repR = normal(_b[_cons] + _b[scotus_rbg1]*0 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen rbg1_repR = normal(_b[_cons] + _b[scotus_rbg1]*1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_rbg_repR = rbg1_repR - rbg0_repR
sum rbg0_repR rbg1_repR effect_rbg_repR 


* NPA RBG replacement
gen rbg0_npaR = normal(_b[_cons] + _b[scotus_rbg1]*0 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen rbg1_npaR = normal(_b[_cons] + _b[scotus_rbg1]*1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_rbg_npaR = rbg1_npaR - rbg0_npaR
sum rbg0_npaR rbg1_npaR effect_rbg_npaR 


						 
*=================================================*
* Predicted Probabilitits for Sociotropic Economy *
*=================================================*

* Democrat Sociotropic Economy
gen socioecon0_demR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*0 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen socioecon1_demR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_socioecon_demR = socioecon1_demR - socioecon0_demR
sum socioecon0_demR socioecon1_demR effect_socioecon_demR 

* Republican Sociotropic Economy
gen socioecon0_repR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*0 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen socioecon1_repR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_socioecon_repR = socioecon1_repR - socioecon0_repR
sum socioecon0_repR socioecon1_repR effect_socioecon_repR 


* NPA Sociotropic Economy
gen socioecon0_npaR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*0 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen socioecon1_npaR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_socioecon_npaR = socioecon1_npaR - socioecon0_npaR
sum socioecon0_npaR socioecon1_npaR effect_socioecon_npaR 
						 
						 
						 

*========================================*
* Predicted Probabilitits for Healthcare *
*========================================*

* Democrat Healthcare
gen health0_demR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*0 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen health1_demR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_health_demR = health1_demR - health0_demR
sum health0_demR health1_demR effect_health_demR 

* Republican Healthcare
gen health0_repR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*0 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen health1_repR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_health_repR = health1_repR - health0_repR
sum health0_repR health1_repR effect_health_repR 


* NPA Healthcare
gen health0_npaR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*0 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen health1_npaR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_health_npaR = health1_npaR - health0_npaR
sum health0_npaR health1_npaR effect_health_npaR 
						 
						 
*=========================================*
* Predicted Probabilitits for Immigration *
*=========================================*

* Democrat Immigration
gen immigration0_demR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*0 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen immigration1_demR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_immigration_demR = immigration1_demR - immigration0_demR
sum immigration0_demR immigration1_demR effect_immigration_demR 

* Republican Immigration
gen immigration0_repR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*0 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen immigration1_repR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_immigration_repR = immigration1_repR - immigration0_repR
sum immigration0_repR immigration1_repR effect_immigration_repR 


* NPA Immigration
gen immigration0_npaR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*0 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen immigration1_npaR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_immigration_npaR = immigration1_npaR - immigration0_npaR
sum immigration0_npaR immigration1_npaR effect_immigration_npaR 
											 
						 
						 
						 
						 
						 
		
		
		
*===============================================================*		
*===============================================================*
* Predicted Probabilitits with Observed Values for Switcher to  *
* Major Party D --> R, Model 4                                  *
*===============================================================*
*===============================================================*

logit dem_switchers1  scotus_rbg1 police1 economy_pocketbook_rescaled1 ///
      economy_socio_rescaled1 healthcare_rescaled1  immigration_rescaled1  ///
	  political_awareness1  contracted_covid1  partyid_dum2 partyid_dum3 ideology1 ///
	  age1 female1 race_dum2 race_dum3 race_dum4  education1  income1, vce(robust)

predict p1 if e(sample)
sum p1

*=============================================*
* Predicted Probabilitits for RBG replacement *
*=============================================*

* Democrat RBG replacement
gen rbg0_demD = normal(_b[_cons] + _b[scotus_rbg1]*0 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen rbg1_demD = normal(_b[_cons] + _b[scotus_rbg1]*1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_rbg_demD = rbg1_demD - rbg0_demD
sum rbg0_demD rbg1_demD effect_rbg_demD 

* Republican RBG replacement
gen rbg0_repD = normal(_b[_cons] + _b[scotus_rbg1]*0 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen rbg1_repD = normal(_b[_cons] + _b[scotus_rbg1]*1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_rbg_repD = rbg1_repD - rbg0_repD
sum rbg0_repD rbg1_repD effect_rbg_repD 


* NPA RBG replacement
gen rbg0_npaD = normal(_b[_cons] + _b[scotus_rbg1]*0 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen rbg1_npaD = normal(_b[_cons] + _b[scotus_rbg1]*1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_rbg_npaD = rbg1_npaD - rbg0_npaD
sum rbg0_npaD rbg1_npaD effect_rbg_npaD 


						 
*=================================================*
* Predicted Probabilitits for Sociotropic Economy *
*=================================================*

* Democrat Sociotropic Economy
gen socioecon0_demD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*0 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen socioecon1_demD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_socioecon_demD = socioecon1_demD - socioecon0_demD
sum socioecon0_demD socioecon1_demD effect_socioecon_demD 

* Republican Sociotropic Economy
gen socioecon0_repD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*0 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen socioecon1_repD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_socioecon_repD = socioecon1_repD - socioecon0_repD
sum socioecon0_repD socioecon1_repD effect_socioecon_repD 


* NPA Sociotropic Economy
gen socioecon0_npaD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*0 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen socioecon1_npaD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_socioecon_npaD = socioecon1_npaD - socioecon0_npaD
sum socioecon0_npaD socioecon1_npaD effect_socioecon_npaD 
						 
						 
						 

*========================================*
* Predicted Probabilitits for Healthcare *
*========================================*

* Democrat Healthcare
gen health0_demD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*0 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen health1_demD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_health_demD = health1_demD - health0_demD
sum health0_demD health1_demD effect_health_demD 

* Republican Healthcare
gen health0_repD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*0 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen health1_repD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_health_repD = health1_repD - health0_repD
sum health0_repD health1_repD effect_health_repD 


* NPA Healthcare
gen health0_npaD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*0 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen health1_npaD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_health_npaD = health1_npaD - health0_npaD
sum health0_npaD health1_npaD effect_health_npaD 
						 
						 
*=========================================*
* Predicted Probabilitits for Immigration *
*=========================================*

* Democrat Immigration
gen immigration0_demD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*0 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen immigration1_demD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_immigration_demD = immigration1_demD - immigration0_demD
sum immigration0_demD immigration1_demD effect_immigration_demD 

* Republican Immigration
gen immigration0_repD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*0 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen immigration1_repD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_immigration_repD = immigration1_repD - immigration0_repD
sum immigration0_repD immigration1_repD effect_immigration_repD 


* NPA Immigration
gen immigration0_npaD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*0 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen immigration1_npaD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_immigration_npaD = immigration1_npaD - immigration0_npaD
sum immigration0_npaD immigration1_npaD effect_immigration_npaD 
						 
						 
						 
						 

		
		
*===============================================================*
*===============================================================*
* Predicted Probabilitits with Observed Values for Switcher to  *
* Major Party O --> R, Model 4                                  *
*===============================================================*
*===============================================================*


logit other_trump_switchers1  scotus_rbg1 police1 economy_pocketbook_rescaled1 ///
      economy_socio_rescaled1 healthcare_rescaled1  immigration_rescaled1  ///
	  political_awareness1  contracted_covid1  partyid_dum2 partyid_dum3 ideology1 ///
	  age1 female1 race_dum2 race_dum3 race_dum4  education1  income1, vce(robust)

predict p2 if e(sample)
sum p2

*=============================================*
* Predicted Probabilitits for RBG replacement *
*=============================================*

* Democrat RBG replacement
gen rbg0_demOR = normal(_b[_cons] + _b[scotus_rbg1]*0 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen rbg1_demOR = normal(_b[_cons] + _b[scotus_rbg1]*1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_rbg_demOR = rbg1_demOR - rbg0_demOR
sum rbg0_demOR rbg1_demOR effect_rbg_demOR 

* Republican RBG replacement
gen rbg0_repOR = normal(_b[_cons] + _b[scotus_rbg1]*0 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen rbg1_repOR = normal(_b[_cons] + _b[scotus_rbg1]*1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_rbg_repOR = rbg1_repOR - rbg0_repOR
sum rbg0_repOR rbg1_repOR effect_rbg_repOR 


* NPA RBG replacement
gen rbg0_npaOR = normal(_b[_cons] + _b[scotus_rbg1]*0 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen rbg1_npaOR = normal(_b[_cons] + _b[scotus_rbg1]*1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_rbg_npaOR = rbg1_npaOR - rbg0_npaOR
sum rbg0_npaOR rbg1_npaOR effect_rbg_npaOR 


						 
*=================================================*
* Predicted Probabilitits for Sociotropic Economy *
*=================================================*

* Democrat Sociotropic Economy
gen socioecon0_demOR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*0 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen socioecon1_demOR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_socioecon_demOR = socioecon1_demOR - socioecon0_demOR
sum socioecon0_demOR socioecon1_demOR effect_socioecon_demOR 

* Republican Sociotropic Economy
gen socioecon0_repOR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*0 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen socioecon1_repOR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_socioecon_repOR = socioecon1_repOR - socioecon0_repOR
sum socioecon0_repOR socioecon1_repOR effect_socioecon_repOR 


* NPA Sociotropic Economy
gen socioecon0_npaOR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*0 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen socioecon1_npaOR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_socioecon_npaOR = socioecon1_npaOR - socioecon0_npaOR
sum socioecon0_npaOR socioecon1_npaOR effect_socioecon_npaOR 
						 
						 
						 

*========================================*
* Predicted Probabilitits for Healthcare *
*========================================*

* Democrat Healthcare
gen health0_demOR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*0 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen health1_demOR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_health_demOR = health1_demOR - health0_demOR
sum health0_demOR health1_demOR effect_health_demOR 

* Republican Healthcare
gen health0_repOR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*0 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen health1_repOR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_health_repOR = health1_repOR - health0_repOR
sum health0_repOR health1_repOR effect_health_repOR 


* NPA Healthcare
gen health0_npaOR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*0 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen health1_npaOR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_health_npaOR = health1_npaOR - health0_npaOR
sum health0_npaOR health1_npaOR effect_health_npaOR 
						 
						 
*=========================================*
* Predicted Probabilitits for Immigration *
*=========================================*

* Democrat Immigration
gen immigration0_demOR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*0 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen immigration1_demOR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_immigration_demOR = immigration1_demOR - immigration0_demOR
sum immigration0_demOR immigration1_demOR effect_immigration_demOR 

* Republican Immigration
gen immigration0_repOR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*0 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen immigration1_repOR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_immigration_repOR = immigration1_repOR - immigration0_repOR
sum immigration0_repOR immigration1_repOR effect_immigration_repOR 


* NPA Immigration
gen immigration0_npaOR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*0 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen immigration1_npaOR = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_immigration_npaOR = immigration1_npaOR - immigration0_npaOR
sum immigration0_npaOR immigration1_npaOR effect_immigration_npaOR 
		
						 
						 
						 
						 
						 
						 
						 
						 
						 
*===============================================================*
*===============================================================*
* Predicted Probabilitits with Observed Values for Switcher to  *
* Major Party O --> D, Model 4                                  *
*===============================================================*
*===============================================================*

logit other_dem_switchers1  scotus_rbg1 police1 economy_pocketbook_rescaled1 ///
      economy_socio_rescaled1 healthcare_rescaled1  immigration_rescaled1  ///
	  political_awareness1  contracted_covid1  partyid_dum2 partyid_dum3 ideology1 ///
	  age1 female1 race_dum2 race_dum3 race_dum4  education1  income1, vce(robust)

predict p3 if e(sample)
sum p3

*=============================================*
* Predicted Probabilitits for RBG replacement *
*=============================================*

* Democrat RBG replacement
gen rbg0_demOD = normal(_b[_cons] + _b[scotus_rbg1]*0 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen rbg1_demOD = normal(_b[_cons] + _b[scotus_rbg1]*1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_rbg_demOD = rbg1_demOD - rbg0_demOD
sum rbg0_demOD rbg1_demOD effect_rbg_demOD 

* Republican RBG replacement
gen rbg0_repOD = normal(_b[_cons] + _b[scotus_rbg1]*0 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen rbg1_repOD = normal(_b[_cons] + _b[scotus_rbg1]*1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_rbg_repOD = rbg1_repOD - rbg0_repOD
sum rbg0_repOD rbg1_repOD effect_rbg_repOD 


* NPA RBG replacement
gen rbg0_npaOD = normal(_b[_cons] + _b[scotus_rbg1]*0 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen rbg1_npaOD = normal(_b[_cons] + _b[scotus_rbg1]*1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_rbg_npaOD = rbg1_npaOD - rbg0_npaOD
sum rbg0_npaOD rbg1_npaOD effect_rbg_npaOD 


						 
*=================================================*
* Predicted Probabilitits for Sociotropic Economy *
*=================================================*

* Democrat Sociotropic Economy
gen socioecon0_demOD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*0 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen socioecon1_demOD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_socioecon_demOD = socioecon1_demOD - socioecon0_demOD
sum socioecon0_demOD socioecon1_demOD effect_socioecon_demOD 

* Republican Sociotropic Economy
gen socioecon0_repOD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*0 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen socioecon1_repOD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_socioecon_repOD = socioecon1_repOD - socioecon0_repOD
sum socioecon0_repOD socioecon1_repOD effect_socioecon_repOD 


* NPA Sociotropic Economy
gen socioecon0_npaOD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*0 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen socioecon1_npaOD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_socioecon_npaOD = socioecon1_npaOD - socioecon0_npaOD
sum socioecon0_npaOD socioecon1_npaOD effect_socioecon_npaOD 
						 
						 
						 

*========================================*
* Predicted Probabilitits for Healthcare *
*========================================*

* Democrat Healthcare
gen health0_demOD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*0 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen health1_demOD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_health_demOD = health1_demOD - health0_demOD
sum health0_demOD health1_demOD effect_health_demOD 

* Republican Healthcare
gen health0_repOD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*0 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen health1_repOD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_health_repOD = health1_repOD - health0_repOD
sum health0_repOD health1_repOD effect_health_repOD 


* NPA Healthcare
gen health0_npaOD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*0 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen health1_npaOD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_health_npaOD = health1_npaOD - health0_npaOD
sum health0_npaOD health1_npaOD effect_health_npaOD 
						 
						 
*=========================================*
* Predicted Probabilitits for Immigration *
*=========================================*

* Democrat Immigration
gen immigration0_demOD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*0 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen immigration1_demOD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_immigration_demOD = immigration1_demOD - immigration0_demOD
sum immigration0_demOD immigration1_demOD effect_immigration_demOD 

* Republican Immigration
gen immigration0_repOD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*0 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen immigration1_repOD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_immigration_repOD = immigration1_repOD - immigration0_repOD
sum immigration0_repOD immigration1_repOD effect_immigration_repOD 


* NPA Immigration
gen immigration0_npaOD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*0 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen immigration1_npaOD = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_immigration_npaOD = immigration1_npaOD - immigration0_npaOD
sum immigration0_npaOD immigration1_npaOD effect_immigration_npaOD 
						 
						 
						 
						 
						 
						 
						 
						 

						 
						 
						 
						 
*======================================================================*
*======================================================================*
* Predicted Probabilitits with Observed Values for New Voters, Model 4 *   
*======================================================================*
*======================================================================*

logit biden_20201  scotus_rbg1 police1 economy_pocketbook_rescaled1 ///
      economy_socio_rescaled1 healthcare_rescaled1  immigration_rescaled1  ///
	  political_awareness1  contracted_covid1  partyid_dum2 partyid_dum3 ideology1 ///
	  age1 female1 race_dum2 race_dum3 race_dum4  education1  income1, vce(robust)

predict p4 if e(sample)
sum p4

*=============================================*
* Predicted Probabilitits for RBG replacement *
*=============================================*

* Democrat RBG replacement
gen rbg0_demB = normal(_b[_cons] + _b[scotus_rbg1]*0 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen rbg1_demB = normal(_b[_cons] + _b[scotus_rbg1]*1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_rbg_demB = rbg1_demB - rbg0_demB
sum rbg0_demB rbg1_demB effect_rbg_demB 

* Republican RBG replacement
gen rbg0_repB = normal(_b[_cons] + _b[scotus_rbg1]*0 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen rbg1_repB = normal(_b[_cons] + _b[scotus_rbg1]*1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_rbg_repB = rbg1_repB - rbg0_repB
sum rbg0_repB rbg1_repB effect_rbg_repB 


* NPA RBG replacement
gen rbg0_npaB = normal(_b[_cons] + _b[scotus_rbg1]*0 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen rbg1_npaB = normal(_b[_cons] + _b[scotus_rbg1]*1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_rbg_npaB = rbg1_npaB - rbg0_npaB
sum rbg0_npaB rbg1_npaB effect_rbg_npaB 


						 
*=================================================*
* Predicted Probabilitits for Sociotropic Economy *
*=================================================*

* Democrat Sociotropic Economy
gen socioecon0_demB = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*0 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen socioecon1_demB = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_socioecon_demB = socioecon1_demB - socioecon0_demB
sum socioecon0_demB socioecon1_demB effect_socioecon_demB 

* Republican Sociotropic Economy
gen socioecon0_repB = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*0 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen socioecon1_repB = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_socioecon_repB = socioecon1_repB - socioecon0_repB
sum socioecon0_repB socioecon1_repB effect_socioecon_repB 


* NPA Sociotropic Economy
gen socioecon0_npaB = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*0 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen socioecon1_npaB = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_socioecon_npaB = socioecon1_npaB - socioecon0_npaB
sum socioecon0_npaB socioecon1_npaB effect_socioecon_npaB 
						 
						 
						 

*========================================*
* Predicted Probabilitits for Healthcare *
*========================================*

* Democrat Healthcare
gen health0_demB = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*0 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen health1_demB = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_health_demB = health1_demB - health0_demB
sum health0_demB health1_demB effect_health_demB 

* Republican Healthcare
gen health0_repB = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*0 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen health1_repB = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_health_repB = health1_repB - health0_repB
sum health0_repB health1_repB effect_health_repB 


* NPA Healthcare
gen health0_npaB = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*0 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen health1_npaB = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*1 + ///
					   _b[immigration_rescaled1]*immigration_rescaled1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_health_npaB = health1_npaB - health0_npaB
sum health0_npaB health1_npaB effect_health_npaB 
						 
						 
*=========================================*
* Predicted Probabilitits for Immigration *
*=========================================*

* Democrat Immigration
gen immigration0_demB = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*0 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen immigration1_demB = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*1 + _b[partyid_dum3]*partyid_dum3 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_immigration_demB = immigration1_demB - immigration0_demB
sum immigration0_demB immigration1_demB effect_immigration_demB 

* Republican Immigration
gen immigration0_repB = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*0 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen immigration1_repB = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*partyid_dum2 + _b[partyid_dum3]*1 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_immigration_repB = immigration1_repB - immigration0_repB
sum immigration0_repB immigration1_repB effect_immigration_repB 


* NPA Immigration
gen immigration0_npaB = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*0 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   
gen immigration1_npaB = normal(_b[_cons] + _b[scotus_rbg1]*scotus_rbg1 + _b[partyid_dum2]*0 + _b[partyid_dum3]*0 + ///
                       _b[police1]*police1 + _b[economy_pocketbook_rescaled1]*economy_pocketbook_rescaled1 + ///
					   _b[economy_socio_rescaled1]*economy_socio_rescaled1 + _b[healthcare_rescaled1]*healthcare_rescaled1 + ///
					   _b[immigration_rescaled1]*1 + _b[political_awareness1]*political_awareness1 + ///
					   _b[ideology1]*ideology1 + _b[age1]*age1 + _b[female1]*female1 + _b[race_dum2]*race_dum2 + ///
					   _b[race_dum3]*race_dum3 + _b[race_dum4]*race_dum4 + _b[education1]*education1 + _b[income1]*income1) if e(sample)
					   

gen effect_immigration_npaB = immigration1_npaB - immigration0_npaB
sum immigration0_npaB immigration1_npaB effect_immigration_npaB 
						 
						 
						 
						 
						 
						 
						 
						 
						 
						 
